package Year22_Month03.day20;

public class Bonus {
    public int getMost(int[][] board) {
        // write code here
        //先处理一直往下走或者说一直往右走的特殊情况
        for(int i = 1;i < 6;i++){
            board[0][i] += board[0][i - 1];
            board[i][0] += board[i - 1][0];
        }
        //然后处理其他情况
        for (int i = 0; i < 6; i++) {
            for (int j = 0; j < 6; j++) {
                board[i][j] = Math.max(board[i - 1][j],board[i][j - 1]);
            }
        }
        return board[5][5];
    }
}
